// 获取网格配置
export function getGrid(status, defaultGrid = {}) {
  const { top, bottom, left, right } = defaultGrid;
  const set = [
    {
      label: '距离顶部距离',
      type: 'inputNumber',
      field: 'xAxis_top',
      optionField: 'style.grid.top',
      value: top || 25,
      tabName: 'custom',
      groupName: 'grid',
    },
    {
      label: '距离底部距离',
      type: 'inputNumber',
      field: 'xAxis_bottom',
      optionField: 'style.grid.bottom',
      value: bottom || 30,
      tabName: 'custom',
      groupName: 'grid',
    },
    {
      label: '距离左侧距离',
      type: 'inputNumber',
      field: 'yAxis_left',
      optionField: 'style.grid.left',
      value: left || 80,
      tabName: 'custom',
      groupName: 'grid',
    },
    {
      label: '距离右侧距离',
      type: 'inputNumber',
      field: 'yAxis_right',
      optionField: 'style.grid.right',
      value: right || 40,
      tabName: 'custom',
      groupName: 'grid',
    },
  ];
  const data = {
    bottom: 30,
    top: 25,
    left: 80,
    right: 40,
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}
// 获取标题
export function getTitleUnit(status) {
  const set = [
    {
      label: '单位',
      // 设置组件类型
      type: 'input',
      // 字段
      field: 'unit',
      // 对应options中的字段
      optionField: 'style.unit',
      value: '',
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '单位偏移',
      // 设置组件类型
      type: 'input',
      // 字段
      field: 'unit_offset',
      // 对应options中的字段
      optionField: 'style.unitOffset',
      value: '5,-15',
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '单位字体大小',
      // 设置组件类型
      type: 'inputNumber',
      // 字段
      field: 'unit_fontSize',
      // 对应options中的字段
      optionField: 'style.unitFontSize',
      value: 20,
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '单位字体颜色',
      // 设置组件类型
      type: 'colorPicker',
      // 字段
      field: 'unit_color',
      // 对应options中的字段
      optionField: 'style.unitColor',
      value: '#ffffff',
      tabName: 'custom',
      groupName: 'graph',
    },
  ];
  const data = {
    unit: '',
    unitOffset: '5,-15',
    unitFontSize: 20,
    unitColor: '#fff',
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}
// 获取提示配置
export function getTooltip(status) {
  const set = [
    {
      label: '显示tootip',
      type: 'switch',
      field: 'tooltip_show',
      optionField: 'style.tooltip.show',
      value: true,
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '鼠标悬浮后弹窗背景',
      // 设置组件类型
      type: 'colorPicker',
      // 字段
      field: 'tooltip_color',
      // 对应options中的字段
      optionField: 'style.tooltip.color',
      value: 'rgba(255,255,255,1)',
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '悬浮窗体额外处理',
      // 设置组件类型
      type: 'textarea',
      // 字段
      field: 'tooltip_execFn',
      // 对应options中的字段
      optionField: 'style.tooltip.execFn',
      value: '',
      tabName: 'custom',
      rows: 8,
      placeholder: `// 此处可以获取到data变量\nconsole.log(data);\n// 通过对data的处理，最终返回悬浮窗的样式\nreturn '<div></div>'`,
      groupName: 'graph',
    },{
      label: '鼠标悬浮后弹窗字体颜色',
      // 设置组件类型
      type: 'colorPicker',
      // 字段
      field: 'tooltip_textStyle_color',
      // 对应options中的字段
      optionField: 'style.tooltip.textStyle.color',
      value: '#000',
      tabName: 'custom',
      groupName: 'graph',
    },
    {
      label: '鼠标悬浮后弹窗字体大小',
      // 设置组件类型
      type: 'inputNumber',
      // 字段
      field: 'tooltip_textStyle_fontSize',
      // 对应options中的字段
      optionField: 'style.tooltip.textStyle.fontSize',
      value: 14,
      tabName: 'custom',
      groupName: 'graph',
    }
  ];
  const data = {
    show: '',
    color: 'rgba(255,255,255,0.5)',
    execFn: '',
    textStyle: {
      color: '',
      fontSize: ''
    }
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}
// 获取x轴配置
export function getXAxis(status) {
  const set = [
    {
      label: '显示x轴',
      type: 'switch',
      field: 'xAxis_x_show',
      optionField: 'style.x.show',
      value: true,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: 'type',
      type: 'input',
      field: 'xAxis_x_type',
      optionField: 'style.x.type',
      value: 'category',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: 'X轴位置',
      type: 'select',
      field: 'xAxis_x_position',
      optionField: 'style.x.position',
      options: [
        {
          label: 'top',
          value: 'top',
        },
        {
          label: 'bottom',
          value: 'bottom',
        }
      ],
      value: 'bottom',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: 'x轴数据格式化(模板字符)',
      type: 'textarea',
      field: 'xAxis_x_axisLabel_formatter',
      optionField: 'style.x.axisLabel.formatter',
      value: '{value}',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: 'x轴数据格式化(方法)',
      type: 'textarea',
      field: 'xAxis_x_axisLabel_formatter2',
      optionField: 'style.x.axisLabel.formatter2',
      value: '',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '显示轴线',
      type: 'switch',
      field: 'xAxis_axisLine_show',
      optionField: 'style.x.axisLine.show',
      value: true,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '轴线宽度',
      type: 'inputNumber',
      field: 'xAxis_axisLine_width',
      optionField: 'style.x.axisLine.width',
      value: 1.5,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '轴线颜色',
      type: 'colorPicker',
      field: 'xAxis_axisLine_color',
      optionField: 'style.x.axisLine.color',
      value: '#818181',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '显示分隔线',
      type: 'switch',
      field: 'xAxis_splitLine_show',
      optionField: 'style.x.splitLine.show',
      value: true,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '分隔线宽度',
      type: 'inputNumber',
      field: 'xAxis_splitLine_width',
      optionField: 'style.x.splitLine.width',
      value: 1.5,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '分隔线间隔',
      type: 'inputNumber',
      field: 'xAxis_splitLine_interval',
      optionField: 'style.x.splitLine.interval',
      value: true,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '分隔线颜色',
      type: 'colorPicker',
      field: 'xAxis_splitLine_color',
      optionField: 'style.x.splitLine.color',
      value: 'rgba(192, 192, 192, .27)',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '显示标签',
      type: 'switch',
      field: 'xAxis_axisLabel_show',
      optionField: 'style.x.axisLabel.show',
      value: true,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '标签距离轴线距离',
      type: 'inputNumber',
      field: 'xAxis_axisLabel_margin',
      optionField: 'style.x.axisLabel.margin',
      value: 8,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '标签颜色',
      type: 'colorPicker',
      field: 'xAxis_axisLabel_color',
      optionField: 'style.x.axisLabel.color',
      // 是否多选
      multiple: false,
      value: '#fff',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '标签字体大小',
      type: 'inputNumber',
      field: 'xAxis_axisLabel_fontSize',
      optionField: 'style.x.axisLabel.fontSize',
      value: 16,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '字体类型',
      type: 'select',
      field: 'xAxis_axisLabel_fontFamily',
      optionField: 'style.x.axisLabel.fontFamily',
      options: [
        {
          label: '默认',
          value: 'ping-fang',
        },
        {
          label: '数字加粗',
          value: 'dinpro-bold',
        },
        {
          label: '英文扁平体',
          value: 'alihan',
        },
      ],
      value: 'ping-fang',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '标签旋转角度',
      type: 'inputNumber',
      field: 'xAxis_axisLabel_rotate',
      optionField: 'style.x.axisLabel.rotate',
      value: 0,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '间隔设置(数字或auto)',
      type: 'input',
      field: 'xAxis_axisLabel_interval',
      optionField: 'style.x.axisLabel.interval',
      value: 0,
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '宽度(none 或数字)',
      type: 'input',
      field: 'xAxis_axisLabel_width',
      optionField: 'style.x.axisLabel.width',
      value: 'none',
      tabName: 'custom',
      groupName: 'xAxis',
    },
    {
      label: '文本显示(设置宽度才会生效)',
      type: 'select',
      field: 'xAxis_axisLabel_overflow',
      optionField: 'style.x.axisLabel.overflow',
      options: [
        {
          label: '截断',
          value: 'truncate',
        },
        {
          label: '普通换行',
          value: 'break',
        },
        {
          label: '所有文本换行',
          value: 'breakAll',
        },
      ],
      value: 'breakAll',
      tabName: 'custom',
      groupName: 'xAxis',
    },
  ];
  const data = {
    show: true,
    type: 'category',
    position: 'bottom',
    axisLine: {
      show: true,
      width: 1.5,
      color: '#818181',
    },
    splitLine: {
      width: 1.5,
      show: true,
      interval: 0,
      color: 'rgba(192, 192, 192, .27)',
      type: 'dashed',
    },
    axisLabel: {
      show: true,
      margin: 8,
      width: 'none',
      overflow: 'breakAll',
      rotate: 0,
      interval: 'auto',
      color: '#fff',
      fontSize: 16,
      formatter: '{value}',
      formatter2: '',
      fontFamily: 'dinpro-bold',
    },
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}
// 获取y轴配置
export function getYAxis(status) {
  const set = [
    {
      label: '显示y轴',
      type: 'switch',
      field: 'yAxis_y_show',
      optionField: 'style.y.show',
      value: true,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: 'y轴数据格式化(模板字符串)',
      type: 'textarea',
      field: 'yAxis_y_axisLabel_formatter',
      optionField: 'style.y.axisLabel.formatter',
      value: '{value}%',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: 'y轴数据格式化(方法)',
      type: 'textarea',
      field: 'yAxis_y_axisLabel_formatter2',
      optionField: 'style.y.axisLabel.formatter2',
      value: '',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '显示轴线',
      type: 'switch',
      field: 'yAxis_axisLine_show',
      optionField: 'style.y.axisLine.show',
      value: true,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '轴线宽度',
      type: 'inputNumber',
      field: 'yAxis_axisLine_width',
      optionField: 'style.y.axisLine.width',
      value: 1.5,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '轴线颜色',
      type: 'colorPicker',
      field: 'yAxis_axisLine_color',
      optionField: 'style.y.axisLine.color',
      value: '#818181',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '显示分隔线',
      type: 'switch',
      field: 'yAxis_splitLine_show',
      optionField: 'style.y.splitLine.show',
      value: true,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '分隔线宽度',
      type: 'inputNumber',
      field: 'yAxis_splitLine_width',
      optionField: 'style.y.splitLine.width',
      value: 1.5,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '分隔线间隔',
      type: 'inputNumber',
      field: 'yAxis_splitLine_interval',
      optionField: 'style.y.splitLine.interval',
      value: true,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '分隔线颜色',
      type: 'colorPicker',
      field: 'yAxis_splitLine_color',
      optionField: 'style.y.splitLine.color',
      value: 'rgba(192, 192, 192, .27)',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '分隔线类型',
      type: 'input',
      field: 'yAxis_splitLine_type',
      optionField: 'style.y.splitLine.type',
      value: 'dashed',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: 'name配置',
      type: 'editor',
      field: 'yAxis_nameOptions',
      optionField: 'style.y.nameOptions',
      value: `${JSON.stringify({})}`,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '显示标签',
      type: 'switch',
      field: 'yAxis_axisLabel_show',
      optionField: 'style.y.axisLabel.show',
      value: true,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '标签距离轴线距离',
      type: 'inputNumber',
      field: 'yAxis_axisLabel_margin',
      optionField: 'style.y.axisLabel.margin',
      value: 8,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '标签颜色',
      type: 'colorPicker',
      field: 'yAxis_axisLabel_color',
      optionField: 'style.y.axisLabel.color',
      // 是否多选
      multiple: false,
      value: '#fff',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '标签字体大小',
      type: 'inputNumber',
      field: 'yAxis_axisLabel_size',
      optionField: 'style.y.axisLabel.fontSize',
      value: 20,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '字体类型',
      type: 'select',
      field: 'yAxis_axisLabel_fontFamily',
      optionField: 'style.y.axisLabel.fontFamily',
      options: [
        {
          label: '默认',
          value: 'ping-fang',
        },
        {
          label: '数字加粗',
          value: 'dinpro-bold',
        },
        {
          label: '英文扁平体',
          value: 'alihan',
        },
      ],
      value: 'ping-fang',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '标签旋转角度',
      type: 'inputNumber',
      field: 'yAxis_axisLabel_rotate',
      optionField: 'style.y.axisLabel.rotate',
      value: 0,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '间隔设置(数字或auto)',
      type: 'input',
      field: 'yAxis_axisLabel_interval',
      optionField: 'style.y.axisLabel.interval',
      value: 'auto',
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '使用最小值',
      type: 'switch',
      field: 'yAxis_y_useMin',
      optionField: 'style.y.useMin',
      value: false,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '最小值增量系数（0-1）',
      type: 'inputNumber',
      field: 'yAxis_y_minRate',
      optionField: 'style.y.minRate',
      value: 0.1,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '使用最大值',
      type: 'switch',
      field: 'yAxis_y_useMax',
      optionField: 'style.y.useMax',
      value: false,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '最大值增量系数（0-1）',
      type: 'inputNumber',
      field: 'yAxis_y_maxRate',
      optionField: 'style.y.maxRate',
      value: 0.1,
      tabName: 'custom',
      groupName: 'yAxis',
    },
    {
      label: '分隔个数',
      type: 'inputNumber',
      field: 'yAxis_y_splitInterval',
      optionField: 'style.y.splitInterval',
      value: 6,
      tabName: 'custom',
      groupName: 'yAxis',
    },
  ];
  const data = {
    show: true,
    useMin: false,
    useMax: false,
    maxRate: 0.1,
    minRate: 0.1,
    splitInterval: 6,
    nameOptions: `${JSON.stringify({})}`,
    // name: '',
    // nameLocation: 'end',
    // nameGap: 15,
    // nameRotate : '',
    // nameTextStyle: {
    //   color: '',
    //   fontSize: '',
    //   align: '',
    //   verticalAlign: '',
    // },
    axisLine: {
      show: true,
      width: 1.5,
      color: '#818181',
    },
    splitLine: {
      show: true,
      width: 1.5,
      interval: 0,
      color: 'rgba(192, 192, 192, .27)',
      type: 'dashed',
    },
    axisLabel: {
      show: true,
      margin: 8,
      color: '#fff',
      rotate: 0,
      interval: 'auto',
      formatter: '{value}',
      formatter2: '',
      fontSize: 16,
    },
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}

// 以下方法只存在于options配置

// 获取指标数据配置(紧存在于option中)
export function getIndexData(status) {
  let list = [
      {
        key: 'xField',
        defaultVal: '',
      },
      {
        key: 'yField',
        defaultVal: '',
      },
    ],
    arr = [],
    obj = {
      dataKey: 'data',
      data: [],
    };
  list.forEach(v => {
    const { label, key, defaultVal } = v;
    obj[key] = defaultVal;
    arr.push({
      label,
      type: 'select',
      field: key,
      optionField: key,
      multiple: false,
      value: defaultVal,
      tabName: 'data',
    });
  });
  if (status === 'set') {
    return arr;
  } else if (status === 'data') {
    return obj;
  }
  return {
    set: arr,
    data: obj,
  };
}

// 获取字体相关配置(紧存在于option中)
export function getFont({
  status,
  pName = '',
  gName = '',
  labelWidth = 120,
  defaultVal = {},
}) {
  const { fontSize, fontColor, fontFamily } = defaultVal;
  const set = [
    {
      label: '字体大小',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}fontSize`,
      optionField: `${pName ? pName + '.' : ''}fontSize`,
      value: fontSize || 14,
      labelWidth,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '字体颜色',
      type: 'colorPicker',
      field: `${pName.replace('.', '_')}fontColor`,
      optionField: `${pName ? pName + '.' : ''}fontColor`,
      value: fontColor || '#fff',
      tabName: 'custom',
      labelWidth,
      groupName: gName,
    },
    {
      label: '字体类型',
      type: 'select',
      options: [
        {
          label: '默认',
          value: 'ping-fang',
        },
        {
          label: '数字加粗',
          value: 'dinpro-bold',
        },
        {
          label: '英文扁平体',
          value: 'alihan',
        },
      ],
      field: `${pName.replace('.', '_')}fontFamily`,
      optionField: `${pName ? pName + '.' : ''}fontFamily`,
      value: fontFamily || 'ping-fang',
      tabName: 'custom',
      labelWidth,
      groupName: gName,
    },
    {
      label: '字重',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}fontWeight`,
      optionField: `${pName ? pName + '.' : ''}fontWeight`,
      value: 400,
      labelWidth,
      tabName: 'custom',
      groupName: gName,
    },
  ];
  const data = {
    fontSize: 14,
    fontColor: '#fff',
    fontFamily: 'ping-fang',
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  }
  return {
    set,
    data,
  };
}
// 获取字体上下左右边距配置(紧存在于option中)
export function getPaddingMargin({ status, pName = '', gName = '' }) {
  const set = [
    {
      label: '上边距',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}innerTop`,
      optionField: `${pName ? pName + '.' : ''}innerTop`,
      value: 8,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '下边距',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}innerBttom`,
      optionField: `${pName ? pName + '.' : ''}innerBttom`,
      value: 8,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '左边距',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}innerLeft`,
      optionField: `${pName ? pName + '.' : ''}innerLeft`,
      value: 15,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '右边距',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}innerRight`,
      optionField: `${pName ? pName + '.' : ''}innerRight`,
      value: 15,
      tabName: 'custom',
      groupName: gName,
    },
  ];
  const data = {
    innerTop: 8,
    innerBttom: 8,
    innerLeft: 15,
    innerRight: 15,
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  }
  return {
    set,
    data,
  };
}

// 获取极坐标系配置
export function getPolar(status) {
  const set = [
    {
      label: '中心坐标(像素值或百分比)',
      type: 'input',
      field: 'polar_center',
      optionField: 'style.polar.center',
      value: '50%,50%',
      tabName: 'custom',
      groupName: 'polar',
    },
    {
      label: '半径(像素值或百分比)',
      type: 'input',
      field: 'polar_radius',
      optionField: 'style.polar.radius',
      value: '50%',
      tabName: 'custom',
      groupName: 'polar',
    },
  ];
  const data = {
    center: '50%,50%',
    radius: '50%',
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}

// 获取极坐标系的径向轴配置
export function getRadiusAxis(status) {
  const set = [...getXAxis('set')];
  const data = {
    show: true,
    axisLine: {
      show: false,
      width: 1.5,
      color: '#818181',
    },
    splitLine: {
      width: 1.5,
      show: false,
      interval: 0,
      color: 'rgba(192, 192, 192, .27)',
      type: 'dashed',
    },
    axisLabel: {
      show: false,
      margin: 8,
      width: 'none',
      overflow: 'breakAll',
      rotate: 0,
      interval: 'auto',
      color: '#fff',
      fontSize: 16,
      fontFamily: 'dinpro-bold',
    },
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}

// 获取雷达图坐标系配置
export function getRadar(status) {
  const set = [
    {
      label: '指标名颜色',
      type: 'colorPicker',
      field: 'radar_titleColor',
      optionField: 'style.radar.titleColor',
      // 是否多选
      multiple: false,
      value: '#C1E9FF',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标名字体大小',
      type: 'inputNumber',
      field: 'radar_titleFontSize',
      optionField: 'style.radar.titleFontSize',
      value: 18,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标名字体类型',
      type: 'select',
      field: 'radar_titleFontFamily',
      optionField: 'style.radar.titleFontFamily',
      options: [
        {
          label: '默认',
          value: 'ping-fang',
        },
        {
          label: '数字加粗',
          value: 'dinpro-bold',
        },
        {
          label: '英文扁平体',
          value: 'alihan',
        },
      ],
      value: 'ping-fang',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标名字数字权重',
      type: 'inputNumber',
      field: 'radar_titleFontWeight',
      optionField: 'style.radar.titleFontWeight',
      value: 700,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标名字折行字数',
      type: 'inputNumber',
      field: 'radar_titleWrap',
      optionField: 'style.radar.titleWrap',
      value: 7,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '显示指标值',
      type: 'switch', // 设置组件类型
      field: 'radar_showValue',
      optionField: 'style.radar.showValue',
      value: 0,
      active: 1,
      inactive: 0,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值颜色',
      type: 'colorPicker',
      field: 'radar_valueColor',
      optionField: 'style.radar.valueColor',
      // 是否多选
      multiple: false,
      value: '#fff',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值字体大小',
      type: 'inputNumber',
      field: 'radar_valueFontSize',
      optionField: 'style.radar.valueFontSize',
      value: 24,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值字体类型',
      type: 'select',
      field: 'radar_valueFontFamily',
      optionField: 'style.radar.valueFontFamily',
      options: [
        {
          label: '默认',
          value: 'ping-fang',
        },
        {
          label: '数字加粗',
          value: 'dinpro-bold',
        },
        {
          label: '英文扁平体',
          value: 'alihan',
        },
      ],
      value: 'dinpro-bold',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值对齐方式',
      type: 'select',
      field: 'radar_valueAlign',
      optionField: 'style.radar.valueAlign',
      options: [
        {
          label: '靠左',
          value: 'left',
        },
        {
          label: '居中',
          value: 'center',
        },
        {
          label: '靠右',
          value: 'right',
        },
      ],
      value: 'center',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值数字权重',
      type: 'inputNumber',
      field: 'radar_valueFontWeight',
      optionField: 'style.radar.valueFontWeight',
      value: 700,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '指标值单位',
      type: 'input',
      field: 'radar_valueUnit',
      optionField: 'style.radar.valueUnit',
      value: 'km',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '中心坐标(像素值或百分比)',
      type: 'input',
      field: 'radar_center',
      optionField: 'style.radar.center',
      value: '50%,50%',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '半径(像素值或百分比)',
      type: 'input',
      field: 'radar_radius',
      optionField: 'style.radar.radius',
      value: '65%',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '坐标系起始角度',
      type: 'inputNumber',
      field: 'radar_startAngle',
      optionField: 'style.radar.startAngle',
      value: 120,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '坐标轴轴线宽度',
      type: 'inputNumber',
      field: 'radar_axisLine_width',
      optionField: 'style.radar.axisLine.width',
      value: 1.3,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '坐标轴轴线颜色',
      type: 'colorPicker',
      field: 'radar_axisLine_color',
      optionField: 'style.radar.axisLine.color',
      value: '#28ADE5',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '分隔线宽度',
      type: 'inputNumber',
      field: 'radar_splitLine_width',
      optionField: 'style.radar.splitLine.width',
      value: 1,
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '分隔线颜色',
      type: 'colorPicker',
      field: 'radar_splitLine_color',
      optionField: 'style.radar.splitLine.color',
      value: 'rgba(17, 125, 201, 0.8)',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '奇数圈底色',
      type: 'colorPicker', // 设置组件类型
      field: 'radar_splitArea_alternateColor1', // 字段
      optionField: 'style.radar.splitArea.alternateColor1', // 对应options中的字段
      value: 'transparent',
      tabName: 'custom',
      groupName: 'radar',
    },
    {
      label: '偶数圈底色',
      type: 'colorPicker', // 设置组件类型
      field: 'radar_splitArea_alternateColor2', // 字段
      optionField: 'style.radar.splitArea.alternateColor2', // 对应options中的字段
      value: 'rgba(56,154,255,0.1)',
      tabName: 'custom',
      groupName: 'radar',
    },
  ];
  const data = {
    titleColor: '#C1E9FF',
    titleFontSize: 18,
    titleFontFamily: 'ping-fang',
    titleFontWeight: 700,
    titleWrap: 7,
    showValue: 0,
    valueColor: '#ffffff',
    valueFontSize: 24,
    valueFontFamily: 'dinpro-bold',
    valueAlign: 'center',
    valueFontWeight: 700,
    valueUnit: 'km',
    center: '50%,50%',
    radius: '65%',
    startAngle: 120,
    axisLine: {
      width: 1.3,
      color: '#28ADE5',
    },
    splitLine: {
      width: 1,
      color: 'rgba(17, 125, 201, 0.8)',
    },
    splitArea: {
      alternateColor1: 'transparent',
      alternateColor2: 'rgba(56,154,255,0.1)',
    },
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  } else {
    // 默认返回set
    return {
      set,
      data,
    };
  }
}

// 获取图例

export function getLegend({
  status = 'set',
  pName = 'style.legend',
  gName = '图例',
}) {
  const set = [
    {
      label: '显示图例',
      type: 'switch',
      field: `${pName.replace('.', '_')}legend_show`,
      optionField: `${pName ? pName + '.' : ''}showLegend`,
      value: false,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图例位置',
      type: 'select',
      field: `${pName.replace('.', '_')}legend_positon`,
      optionField: `${pName ? pName + '.' : ''}legendPosition`,
      options: [
        {
          label: '上',
          value: 'top',
        },
        {
          label: '下',
          value: 'bottom',
        },
      ],
      value: 'bottom',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '上方距离',
      type: 'input',
      field: `${pName.replace('.', '_')}legend_top`,
      optionField: `${pName ? pName + '.' : ''}legendTop`,
      value: 'center',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '下方距离',
      type: 'input',
      field: `${pName.replace('.', '_')}legend_bottom`,
      optionField: `${pName ? pName + '.' : ''}legendBottom`,
      value: 0,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '左方距离',
      type: 'input',
      field: `${pName.replace('.', '_')}legend_left`,
      optionField: `${pName ? pName + '.' : ''}legendLeft`,
      value: 'center',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图例名称',
      type: 'input',
      field: `${pName.replace('.', '_')}legend_name`,
      optionField: `${pName ? pName + '.' : ''}legendName`,
      value: '',
      labelWidth: 70,
      placeholder: '比如：图例1,图例2,图例3',
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图例间距',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}legendGap`,
      optionField: `${pName ? pName + '.' : ''}legendGap`,
      value: 10,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图例宽度',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}legendWidth`,
      optionField: `${pName ? pName + '.' : ''}legendWidth`,
      value: 20,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图例高度',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}legendHeight`,
      optionField: `${pName ? pName + '.' : ''}legendHeight`,
      value: 14,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '字体大小',
      type: 'inputNumber',
      field: `${pName.replace('.', '_')}legendTextFontSize`,
      optionField: `${pName ? pName + '.' : ''}legendTextFontSize`,
      value: 16,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '字体颜色',
      type: 'colorPicker',
      field: `${pName.replace('.', '_')}legendTextColor`,
      optionField: `${pName ? pName + '.' : ''}legendTextColor`,
      value: '#fff',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '图标',
      type: 'select',
      field: `${pName.replace('.', '_')}legendIcon`,
      optionField: `${pName ? pName + '.' : ''}legendIcon`,
      options: [
        {
          label: '默认',
          value: '',
        },
        {
          label: '圆形',
          value: 'circle',
        },
        {
          label: '方形',
          value: 'rect',
        },
        {
          label: '圆角方形',
          value: 'roundRect',
        },
        {
          label: '三角形',
          value: 'triangle',
        },
        {
          label: '钻石形',
          value: 'diamond',
        },
        {
          label: '针形',
          value: 'pin',
        },
        {
          label: '箭头',
          value: 'arrow',
        },
      ],
      value: '',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
  ];
  const data = {
    legendTextColor: '',
    legendTextFontSize: '',
    legendHeight: '',
    legendWidth: '',
    legendGap: '',
    legendName: '',
    legendLeft: '',
    legendBottom: '',
    legendTop: '',
    legendPosition: '',
    showLegend: '',
    legendIcon: '',
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  }
  return {
    set,
    data,
  };
}


// 针对series.bar.label的设置
export function getSeriesItemStyleLabel(status) {
  const gName = 'series.bar.label';
  const set = [
    {
      label: '是否显示标签',
      type: 'switch',
      field: `itemStyleLabel_show`,
      optionField: `style.series.show`,
      value: false,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '距离图形元素的距离',
      type: 'inputNumber',
      field: `itemStyleLabel_distance`,
      optionField: `style.series.distance`,
      value: true,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '偏移量',
      type: 'input',
      field: `itemStyleLabel_offset`,
      optionField: `style.series.offset`,
      value: '0,0',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '旋转',
      type: 'inputNumber',
      field: `itemStyleLabel_rotate`,
      optionField: `style.series.rotate`,
      value: 0,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '数据格式化(字符串)',
      type: 'input',
      field: `itemStyleLabel_formatter`,
      optionField: `style.series.formatter`,
      value: '{c}',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '数据格式化(方法)',
      type: 'textarea',
      field: 'itemStyleLabel_formatter2',
      optionField: 'style.series.formatter2',
      value: '',
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '字体颜色',
      type: 'colorPicker',
      field: `itemStyleLabel_color`,
      optionField: `style.series.color`,
      value: '#fff',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '字体大小',
      type: 'inputNumber',
      field: `itemStyleLabel_fontSize`,
      optionField: `style.series.fontSize`,
      value: 12,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '对齐方式',
      type: 'select',
      field: `itemStyleLabel_align`,
      optionField: `style.series.align`,
      options: [
        {
          label: 'left',
          value: 'left',
        },
        {
          label: 'center',
          value: 'center',
        },
        {
          label: 'right',
          value: 'right',
        },
      ], // 对齐方式
      value: '',
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: '位置',
      type: 'select',
      field: `itemStyleLabel_position`,
      optionField: `style.series.position`,
      value: 'inside',
      options: [
        {
          label: 'left',
          value: 'left',
        },
        {
          label: 'top',
          value: 'top',
        },
        {
          label: 'right',
          value: 'right',
        },
        {
          label: 'bottom',
          value: 'bottom',
        },
        {
          label: 'inside',
          value: 'inside',
        },
        {
          label: 'insideLeft',
          value: 'insideLeft',
        },
        {
          label: 'insideTop',
          value: 'insideTop',
        },
        {
          label: 'insideBottom',
          value: 'insideBottom',
        },
        {
          label: 'insideTopLeft',
          value: 'insideTopLeft',
        },
        {
          label: 'insideBottomLeft',
          value: 'insideBottomLeft',
        },
        {
          label: 'insideTopRight',
          value: 'insideTopRight',
        },
        {
          label: 'insideBottomRight',
          value: 'insideBottomRight',
        },
      ],
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    },
    {
      label: 'item颜色设置',
      type: 'colorStepV2',
      field: `itemStyleLabel_itemColors`,
      optionField: `style.series.itemColors`,
      value: [],
      more: true,
      forceColumn: true,
      labelWidth: 70,
      tabName: 'custom',
      groupName: gName,
    }
  ];
  const data = {
    show: '',
    distance: '',
    rotate: '',
    offset: '',
    formatter: '',
    formatter2: '',
    color: '',
    fontSize: '',
    align: '',
    position: '',
    itemColors: '',
  };
  if (status === 'set') {
    return set;
  } else if (status === 'data') {
    return data;
  }
  return {
    set,
    data,
  }
}